package equipement;

import data.ECaracteristique;;

public class Arme extends Objet{

	private EArme arme;
	private int modCaracAssocie;
	private ECaracteristique caracAssocie;
	private Degat degat;
	
	public Arme (EArme arme) {
		this.arme = arme;
		SetDegatBase();
	}
	
	public Arme (EArme arme, int[] Carac) {
		this.arme = arme;
		SetDegatBase();
		SetDegatCarac(Carac);
	}
	
	private void SetDegatBase ()
	{		
		Degat res;
		this.modCaracAssocie = 0;
		
		switch(this.arme)
		{
		case Poing :
			this.caracAssocie = ECaracteristique.FOR;
			res = new Degat(1, 3, this.modCaracAssocie, 20, 2);
			break;
		case EpeeLongue :
			this.caracAssocie = ECaracteristique.FOR;
			res = new Degat(1, 8, this.modCaracAssocie, 19, 2);
			break;
		case EpeeLongueSainteDeFeu :
			this.caracAssocie = ECaracteristique.FOR;
			res = new Degat(1, 8, this.modCaracAssocie+3, 19, 2);
			res.AddDegatDe(2, 6, "Sainte");
			res.AddDegatDe(1, 6, "Feu");
			break;
		case EpeeADeuxMains :
			this.caracAssocie = ECaracteristique.FOR;
			res = new Degat(2, 6, 2*this.modCaracAssocie, 19, 2);
			break;
		case ArcLong :
			this.caracAssocie = null;
			res = new Degat(1, 8, 0, 20, 3);
			break;
		case ArcCourt :
			this.caracAssocie = null;
			res = new Degat(1, 6, 0, 20, 3);
			break;
		case ArbaleteLourde :
			this.caracAssocie = null;
			res = new Degat(1, 10, 0, 19, 2);
			break;
		default :
			res = new Degat(-1,-1,-1,-1,-1);
		}
		
		this.degat = res;
	}
	
	public void SetDegatCarac (int[] Carac) {
		int nouvModif = (Carac[this.caracAssocie.ordinal()]-10)/2;
		
		if(nouvModif!=this.modCaracAssocie)
			this.degat.AddDegatFixe(nouvModif-this.modCaracAssocie);
		this.modCaracAssocie = nouvModif;
	}
	
	public EArme getArme() {
		return arme;
	}
	
	public Degat getDegat() {
		return degat;
	}
		
	public String toString(){
		String res = this.arme.toString() + " : " + this.degat;
		
		return res;
	}

}
